import React,{Component} from 'react';
import './column.css';
import {queryColumn} from "../../api/news";
import Cell from "../../components/cell";

export default class Column extends Component {

  state = {
    column:[],
  };

  async componentDidMount(){
    let {data:column} = await queryColumn();
    this.setState({column});
  }
  render(){
    let {column} = this.state;
    return (
      <div>

        {
          column.map((item,index)=>(
            <Cell
              key={item._id}
              title={item.title}
              label={item.des}
              to={`/detail/${item._id}?collectionName=column`}/>
          ))
        }
      </div>
    )
  }
}